#!/bin/bash

#################################
#测试脚本
#################################

set -x

function check()
{
    pip3 list | grep twisted
    pip3 install pytest incremental zope attrs automat constantly hyperlink
    wget https://gitee.com/spring_view/python3-twisted/raw/master/test_01.py
    nohup python3 test_01.py &
    sleep 30
    lsof -i:8080
    ret=$(echo $?)
    pkill -f test_01.py
    if [[ $ret == 0 ]];then
        echo "RETURN SUCCESS"
    else
        echo "RETURN FAILED"
    fi
}

function main()
{
    ret=$(check)
    if [[ $ret == *'RETURN SUCCESS' ]];then
        echo "test scripts success"
    else
        echo "test scripts failed"
    fi
}
main


